<?php
/**
 * crcl/base
 *
 * Copyright 2013 CRCL - André Sabosch - info@crcl.de
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Config factory
 */

namespace crcl\base;

interface IConfig
{
  public static function reader($sAlias = self::DEFAULT_ALIAS);
//  public static function writer($sAlias = self::DEFAULT_ALIAS);
}

abstract class Config extends instance\Multiton implements IConfig
{
  public static function reader($sAlias = self::DEFAULT_URI)
  {
    return self::getInstance($sAlias);
  }

//  public static function writer($sAlias = self::DEFAULT_URI)
//  {
//    $sClass = '\crcl\base\config\Writer';
//    return self::getInstance($sAlias, $sClass, 'writer');
//  }

  /** PROTECTED ***********************************************************************************/

  protected static $sFactoryDirectory = 'reader';
  protected static $sFactoryClass = '\crcl\base\config\Reader';

  /** PRIVATE *************************************************************************************/

  const DEFAULT_URI = 'ini:///%DIR_APPLICATION_CONFIGS%config.%TIER%.ini';
}